package com.springcloud.api.service.hystrix;

import com.springcloud.api.service.FeignProductService;
import com.springcloud.model.base.Res.BaseRes;
import com.springcloud.model.rest.RestEnum;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author shengtao
 * @Description:
 * @date 2019/06/05 16:33
 */
@Component
public class HystrixProductFallbackFactory implements FallbackFactory<FeignProductService> {
    @Override
    public FeignProductService create(Throwable throwable) {
        return new FeignProductService() {
            @Override
            public BaseRes list() {
                BaseRes res = BaseRes.error(RestEnum.FAILD);
                return res;
            }
        };
    }
}
